package com.ruoyi.controller;

import java.util.ArrayList;
import java.util.List;

public class Dtest {

    public static void main(String[] args) {
        List<List<String>> lists = new ArrayList<>();

        List<String> list1 = new ArrayList<>();
        list1.add("红色");
        list1.add("蓝色");
        list1.add("黄色");
        List<String> list2 = new ArrayList<>();
        list2.add("1");
        list2.add("2");
        List<String> list3 = new ArrayList<>();
        list3.add("3");
        list3.add("4");
        lists.add(list1);
        lists.add(list2);
        lists.add(list3);
        List<String> list = new ArrayList<>();
        String s = "";
        listList(lists, 0, list, s);
        for (String lsien:list) {
            System.out.println(lsien);
        }
    }

    public static void listList(List<List<String>> lists, int index, List<String> list, String s) {
        if (index == lists.size()) {
            list.add(s);
            return;
        }

        for (String list1 : lists.get(index)) {
            String s1 = "";
            s1 = s + "," + list1;
            listList(lists, index + 1, list, s1);
        }
    }
}
